home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 December / PCWDEC06.iso / Software / Trial / Paint Shop Pro XI / Data1.cab / _1BC44CA4345745B6A927EC588135DA87 < prev    next >
Encoding:
Text File  |  2006-08-04  |  16.0 KB  |  417 lines

  1. from PSPApp import *
  2.  
  3. # Copyright 2006 Corel Software Inc., all rights reserved
  4. # This file contains utility routines provided by Corel Software.
  5. # This file contains all translatable strings for the bundled script files.
  6.  
  7. ScriptData = {}
  8.  
  9. class SaveSelection:
  10.     ''' define a helper class that can save any active selection to the alpha
  11.         channel and restore it later
  12.     '''
  13.     def __init__( self, Environment, Doc ):
  14.         ''' at init time we save the environment variable provided by PSP,
  15.             and if a selection exists we save it to an alpha channel
  16.         '''
  17.         self.Env = Environment
  18.         self.SavedSelection =  '__$TempSavedSelection$__'
  19.         self.IsSaved = 0
  20.         self.SavedOnDoc = Doc
  21.         
  22.         SelResult = App.Do( self.Env, 'GetRasterSelectionRect' )
  23.         if SelResult[ 'Type' ] != App.Constants.SelectionType.None:
  24.             # if there is a selection save it to the alpha channel
  25.             App.Do( self.Env, 'SelectSaveDisk', {
  26.                 'FileName': self.SavedSelection, 
  27.                 'Overwrite': App.Constants.Boolean.true, 
  28.                 'GeneralSettings': {
  29.                     'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  30.                     'AutoActionMode': App.Constants.AutoActionMode.Match
  31.                     }
  32.                 }, Doc)
  33.             self.IsSaved = 1    # set this so we know we saved one
  34.             
  35.             if SelResult[ 'Type' ] == App.Constants.SelectionType.Floating:
  36.                 # if the selection is floating promote it to a layer
  37.                 App.Do( self.Env, 'SelectPromote', {
  38.                         'KeepSelection': App.Constants.Boolean.false, 
  39.                         'LayerName': SelectionLayer, 
  40.                         'GeneralSettings': {
  41.                             'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  42.                             'AutoActionMode': App.Constants.AutoActionMode.Match
  43.                             }
  44.                         }, Doc)
  45.             else:
  46.                 App.Do( self.Env, 'SelectNone' )
  47.            
  48.             
  49.     def RestoreSelection( self ):
  50.         ''' if we have saved a selection, restore it now.  If we promoted
  51.             a floating selection to a layer we don't restore the selection
  52.             but don't attempt to mess with the layer in any way
  53.         '''
  54.         if self.IsSaved == 1:
  55.             # load the selection back from disk - this will replace any existing selection
  56.             App.Do( self.Env, 'SelectLoadDisk', {
  57.                     'FileName': self.SavedSelection, 
  58.                     'Operation': App.Constants.SelectionOperation.Replace, 
  59.                     'UpperLeft': App.Constants.Boolean.false, 
  60.                     'ClipToCanvas': App.Constants.Boolean.false, 
  61.                     'GreyMethod': App.Constants.CreateMaskFrom.Luminance, 
  62.                     'Invert': App.Constants.Boolean.false, 
  63.                     'GeneralSettings': {
  64.                         'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  65.                         'AutoActionMode': App.Constants.AutoActionMode.Match
  66.                         }
  67.                     }, self.SavedOnDoc)
  68.  
  69.     # end class SaveSelection
  70.  
  71. def NameFromMaterial( Material, Delimiter=' ', IncludeTexture=1 ):
  72.     ''' Given a material repository, return a name that describes it.
  73.         By default the name is delimited with space, but the delimiter
  74.         parameter can be used to override it.
  75.         By default textures are included in the name, but can be omitted
  76.         by setting the IncludeTexture parameter to 0
  77.     '''
  78.     TextureName = None
  79.     TypeName = ''
  80.     if Material is None:
  81.         CoreName = Null
  82.     else:
  83.         if Material[ 'Pattern' ] and \
  84.            (Material[ 'Pattern' ][ 'Name' ] or Material[ 'Pattern' ][ 'Image' ] ):
  85.             TypeName = Pattern
  86.             if Material[ 'Pattern' ][ 'Name' ]:
  87.                 CoreName = Material[ 'Pattern'  ][ 'Name' ]
  88.             else:
  89.                 CoreName = Inline
  90.         elif Material[ 'Gradient' ] and Material[ 'Gradient' ][ 'Name' ]:
  91.             TypeName = Gradient
  92.             GradType = {}
  93.             GradType[ App.Constants.GradientType.Linear ] = Linear
  94.             GradType[ App.Constants.GradientType.Rectangular ] = Rectangular
  95.             GradType[ App.Constants.GradientType.Radial ] = Radial
  96.             GradType[ App.Constants.GradientType.Angular ] = Sunburst
  97.             
  98.             CoreName = '%s%s%s' % ( Material[ 'Gradient' ][ 'Name' ], Delimiter, 
  99.                                     GradType[ Material[ 'Gradient' ][ 'GradientType' ] ] )
  100.         elif Material[ 'Art' ]:
  101.             TypeName = Art
  102.             CoreName = '%02x%02x%02x' % Material[ 'Art' ][ 'Color' ]
  103.         else:
  104.             TypeName = Solid
  105.             CoreName = '%02x%02x%02x' % Material[ 'Color' ]
  106.  
  107.         if Material[ 'Texture' ] and Material[ 'Texture' ][ 'Name' ]:
  108.             TextureName = Material[ 'Texture' ]['Name']
  109.  
  110.     if TextureName is not None and IncludeTexture != 0:
  111.         MaterialName = '%s%s%s%s%s' % ( TypeName, Delimiter, CoreName, Delimiter, TextureName )
  112.     else:
  113.         MaterialName = '%s%s%s' % ( TypeName, Delimiter, CoreName )
  114.  
  115.     return MaterialName
  116.  
  117. def IsNullMaterial( Material ):
  118.     ' check if the passed in material is none.  Returns true if null, false if non-null'
  119.     if Material is None:    
  120.         return App.Constants.Boolean.true   # material might be entirely none
  121.  
  122.     ArtIsNone = 0
  123.     ColorIsNone = 0
  124.     GradientIsNone = 0
  125.     PatternIsNone = 0
  126.     
  127.     if Material['Color'] is None:
  128.         ColorIsNone = 1
  129.  
  130.     if Material['Gradient'] is None or Material['Gradient']['Name'] is None:
  131.         GradientIsNone = 1
  132.  
  133.     if Material['Pattern'] is None or \
  134.        (Material['Pattern']['Name'] is None and Material['Pattern']['Image'] is None):
  135.         PatternIsNone = 1
  136.  
  137.     if Material['Art'] is None:
  138.         ArtIsNone = 1
  139.  
  140.     if ColorIsNone and GradientIsNone and PatternIsNone and ArtIsNone:
  141.         return App.Constants.Boolean.true   #it works out to none
  142.     else:
  143.         return App.Constants.Boolean.false
  144.  
  145.  
  146. def IsFlatImage( Environment, Doc ):
  147.     'Determine if Doc consists of a single background layer.  True if flat, false if not'
  148.     ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  149.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  150.  
  151.     if ImageInfo[ 'LayerNum' ] == 1 and LayerInfo[ 'IsBackground' ] == App.Constants.Boolean.true:
  152.         return App.Constants.Boolean.true
  153.     else:
  154.         return App.Constants.Boolean.false
  155.  
  156. def IsPaletted( Environment, Doc ):
  157.     '''Determine if the current image is paletted.  Greyscale is not counted as paletted
  158.        Returns true on paletted, false if not
  159.     '''
  160.     # these are all the paletted pixel formats
  161.     TargetFormats = [ App.Constants.PixelFormat.Index1, App.Constants.PixelFormat.Index4,
  162.                       App.Constants.PixelFormat.Index8 ]
  163.     
  164.     # are we paletted?
  165.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  166.  
  167.     if Info['PixelFormat'] in TargetFormats:
  168.         return App.Constants.Boolean.true
  169.     else:
  170.         return App.Constants.Boolean.false
  171.  
  172. def IsTrueColor( Environment, Doc ):
  173.     ''' Determine if the current image is true color.  Greyscale does not count
  174.         Returns true for true color, false for all others
  175.     '''
  176.     TargetFormats = [ App.Constants.PixelFormat.BGR, App.Constants.PixelFormat.BGRA ]
  177.     
  178.     # are we true color?
  179.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  180.     if Info['PixelFormat'] in TargetFormats:
  181.         return App.Constants.Boolean.true
  182.     else:
  183.         return App.Constants.Boolean.false
  184.  
  185. def IsGreyScale( Environment, Doc ):
  186.     ' Determine if the current image (not layer) is greyscale. True if it is, false otherwise'
  187.     TargetFormats = [ App.Constants.PixelFormat.Grey, App.Constants.PixelFormat.GreyA ]
  188.     
  189.     # are we true color?
  190.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  191.     if Info['PixelFormat'] in TargetFormats:
  192.         return App.Constants.Boolean.true
  193.     else:
  194.         return App.Constants.Boolean.false
  195.  
  196. def LayerIsArtMedia( Environment, Doc ):
  197.     'Returns true if the current layer is a artmedia layer'
  198.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  199.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.ArtMedia:
  200.         return App.Constants.Boolean.true
  201.     else:
  202.         return App.Constants.Boolean.false
  203.  
  204. def LayerIsRaster( Environment, Doc ):
  205.     'Returns true if the current layer is a raster layer'
  206.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  207.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Raster:
  208.         return App.Constants.Boolean.true
  209.     else:
  210.         return App.Constants.Boolean.false
  211.  
  212.  
  213. def LayerIsVector( Environment, Doc ):
  214.     'Returns true if the current layer is a vector layer'
  215.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  216.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Vector:
  217.         return App.Constants.Boolean.true
  218.     else:
  219.         return App.Constants.Boolean.false
  220.  
  221. def LayerIsBackground( Environment, Doc ):
  222.     'Returns true if the current layer is the background layer'
  223.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  224.     return LayerInfo[ 'IsBackground' ]
  225.     
  226.  
  227. def GetLayerCount( Environment, Doc ):
  228.     'Returns number of layers in Doc'
  229.     ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  230.     return ImageInfo[ 'LayerNum' ]    
  231.  
  232. def GetCurrentLayerName( Environment, Doc ):
  233.     'Returns the name of the current layer in Doc'
  234.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  235.     return LayerInfo[ 'General' ][ 'Name' ]
  236.  
  237. def PromoteToTrueColor( Environment, Doc ):
  238.     'If the current image type is paletted, promote it to true color.  Greyscale is left alone'
  239.     if IsPaletted( Environment, Doc ):
  240.         App.Do( Environment, 'IncreaseColorsTo16Million', {}, Doc )
  241.     return
  242.  
  243. def RequireADoc( Environment ):
  244.     '''Test that we actually have a target document, and put up a message box if we dont
  245.        Returns true if we have an open doc, false otherwise
  246.     '''
  247.     if App.TargetDocument is None:
  248.         App.Do( Environment, 'MsgBox', {
  249.                 'Buttons': App.Constants.MsgButtons.OK, 
  250.                 'Icon': App.Constants.MsgIcons.Stop, 
  251.                 'Text': RequiresOpenImage, 
  252.                 })
  253.         return App.Constants.Boolean.false
  254.     else:
  255.         return App.Constants.Boolean.true
  256.  
  257. # Begin Translatable Strings
  258. # BevelSelection.PspScript:
  259. LayerName_BevelSelection = u"Selezione smussata"
  260.  
  261. # Black and white pencil.PspScript:
  262. LayerName_Blackandwhitepencil = u"Raster 2"
  263.  
  264. # Border with drop shadow.PspScript:
  265. AlphaName = u"Selection #1"
  266.  
  267. # Flag.PspScript:
  268. #AlphaName = u"Selection #1"
  269.  
  270. # Grey chart.PspScript:
  271. GradientName = u"Primo piano-sfondo"
  272.  
  273. # Sloppy edges.PspScript:
  274. #AlphaName = u"Selection #1"
  275.  
  276. # Toned greyscale.PspScript:
  277. LayerName_Tonedgreyscale = u"Bilanciamento colore 1"
  278.  
  279. # Vignette.PspScript:
  280. LayerName_Vignette = u"Raster 2"
  281.  
  282. # Photo edges.PspScript:
  283. LayerName_Photoedges = u"Raster 2"
  284.  
  285. # SimpleCaption.PspScript:
  286. ImageTooSmallMsg = u"Immagine corrente troppo piccola per assegnarle un titolo - Deve essere almeno 200x200."
  287. MultipleLayersMsg = u"L'immagine corrente Φ distribuita su pi∙ livelli.  Si potrebbero ottenere risultati imprevedibili.\n╚ consigliabile appiattire l'immagine prima di proseguire.  Appiattire l'immagine?"
  288. CaptionPrompt = u"Immettere un titolo per l'immagine.  Verrα posto sotto l'immagine e centrato."
  289. CaptionTitle = u"Immettere il titolo dell'immagine"
  290. PromotedLayerName = u"Immagine"
  291. PageSurfaceLayerName = u"Superficie della pagina"
  292. AlbumPageLayerGroup = u"Pagina album"
  293. DropShadowLayerName = u"Sfumatura"
  294. CaptionTextLayerName = u"Testo del titolo"
  295. CaptionFontName2 = u"Tahoma" 
  296.  
  297. # VectorMergeAndCutoutSelected.PspScript:
  298. TwoOrMoreMsg = u"Per usare questo script devono essere selezionati due o pi∙ oggetti vettoriali." 
  299.  
  300. # VectorMergeSelected.PspScript:
  301. #TwoOrMoreMsg = u"This script requires that two or more vector objects be selected."
  302.  
  303. # AddPSP8FileLocations.PspScript:
  304. NoPSP8FoldersFound = u"Non sono state trovate cartelle di PSP8."
  305. FilesHaveBeenAdded = u"I file in '%s' sono stati aggiunti alle preferenze per i percorsi dei file."
  306. Brushes = u"Pennelli"
  307. BumpMaps = u"Mappe di rugositα"
  308. DeformationMaps = u"Mappe di deformazione"
  309. DisplacementMaps = u"Mappe di posizionamento"
  310. EnvironmentMaps = u"Mappe ambiente"
  311. Gradients = u"Gradienti"
  312. Masks = u"Maschere"
  313. Palettes = u"Tavolozze"
  314. Patterns = u"Motivi"
  315. PictureFrames = u"Cornici immagine"
  316. PictureTubes = u"Ornamenti"
  317. PresetShapes = u"Forme predefinite"
  318. Presets = u"Impostazioni predefinite"
  319. PrintTemplates = u"Modelli di stampa"
  320. QuickGuides = u"Esercitazioni"
  321. SampleImages = u"Immagini campione"
  322. ScriptsRestricted = u"Script con restrizioni"
  323. ScriptsTrusted = u"Script sicuri"
  324. Selections = u"Selezioni"
  325. StyledLines = u"Linee stilizzate"
  326. Swatches = u"Campioni"
  327. Textures = u"Trame"
  328.  
  329. # AddPSP8FileLocationsALL.PspScript:
  330. #NoPSP8FoldersFound = u"No PSP8 folders found."
  331. #FilesHaveBeenAdded = u"Files in '%s' have been added to the File Locations preferences."
  332. #Brushes = u"Brushes"
  333. #BumpMaps = u"Bump Maps"
  334. #DeformationMaps = u"Deformation Maps"
  335. #DisplacementMaps = u"Displacement Maps"
  336. #EnvironmentMaps = u"Environment Maps"
  337. #Gradients = u"Gradients"
  338. #Masks = u"Masks"
  339. #Palettes = u"Palettes"
  340. #Patterns = u"Patterns"
  341. #PictureFrames = u"Picture Frames"
  342. #PictureTubes = u"Picture Tubes"
  343. #PresetShapes = u"Preset Shapes"
  344. #Presets = u"Presets"
  345. #PrintTemplates = u"Print Templates"
  346. #QuickGuides = u"Quick Guides"
  347. #SampleImages = u"Sample Images"
  348. #ScriptsRestricted = u"Scripts-Restricted"
  349. #ScriptsTrusted = u"Scripts-Trusted"
  350. #Selections = u"Selections"
  351. #StyledLines = u"Styled Lines"
  352. #Swatches = u"Swatches"
  353. #Textures = u"Textures"
  354.  
  355. # CapturePalette.PspScript:
  356. RequiresPaletted = u"Questo script richiede un'immagine con tavolozza. Ridurre la profonditα del colore?"
  357. NoPaletteFound = u"Errore interno:  Non sono state trovate tavolozze"
  358. GroutWidthMsg = u"Il valore di GroutWidth deve essere compreso fra 0 e 20"
  359. ColorsPerRowMsg = u"Il valore di ColorsPerRow deve essere compreso fra 1 e 100"
  360. TileSizeMsg = u"Il valore di TileSize deve essere compreso fra 2 e 50"
  361. NumColorsMsg = u"Il numero di colori deve essere compreso fra 2 e 1024"
  362. ButtonMarginMsg = u"Il valore di ButtonMargin deve essere inferiore alla metα del valore di TileSize"
  363. ColorIs = u"Il colore %d Φ (%02X,%02X,%02X)"
  364.  
  365. # EXIFCaptioning.PspScript:
  366. NoEXIFData = u"Non sono stati trovati dati EXIF nell'immagine corrente."
  367. ExposureMsg = u"f/%g apertura, %s esposizione"
  368. CaptionBackground = u"Sfondo del titolo"
  369. EXIFCaption = u"Titolo EXIF"
  370. EXIFText = u"Testo EXIF"
  371. CaptionFontName = u"Arial"
  372.  
  373. # SplitCMYKtoLayerGroup.PspScript:
  374. Black = u"Nero"
  375. BlackChannel = u"Canale nero"
  376. Yellow = u"Giallo"
  377. YellowChannel = u"Canale giallo"
  378. Magenta = u"Magenta"
  379. MagentaChannel = u"Canale magenta"
  380. Cyan = u"Ciano"
  381. CyanChannel = u"Canale ciano"
  382. CMYKChannels = u"Canali CMYK"
  383.  
  384. # SplitHSLtoLayerGroup.PspScript:
  385. Lightness = u"Luminanza"
  386. LightnessChannel = u"Canale luminanza"
  387. Saturation = u"Saturazione"
  388. SaturationChannel = u"Canale saturazione"
  389. Hue = u"Tonalitα"
  390. HueChannel = u"Canale tonalitα"
  391. HSLChannels = u"Canali HSL"
  392.  
  393. # SplitRGBtoLayerGroup.PspScript:
  394. Blue = u"Blu"
  395. BlueChannel = u"Canale blu"
  396. Green = u"Verde"
  397. GreenChannel = u"Canale verde"
  398. Red = u"Rosso"
  399. RedChannel = u"Canale rosso"
  400. RGBChannels = u"Canali RGB"
  401.  
  402. # JascUtils.py, PSPUtils.py
  403. SelectionLayer = u"Selezione sollecitata tramite script"
  404. Pattern = u"Motivo"
  405. Inline = u"Inline"
  406. Gradient = u"Gradiente"
  407. Linear = u"Lineare"
  408. Radial = u"Radiale"
  409. Rectangular = u"Rettangolare"
  410. Sunburst = u"Sprazzo di luce"
  411. Solid = u"Pieno"
  412. Null = u"Nullo"
  413. Art = u"Disegni artistici"
  414. RequiresOpenImage = u"Per usare questo script deve essere aperta un'immagine."
  415. # End Translatable Strings
  416.  
  417.